<form id="loginForm" action="login" method="post">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">登录</h4>
            </div>
            <div class="modal-body">
            	<!-- 以下为要修改的的内容 -->
                <div class="form-group">
                	<label for="txt_name">用户名</label>
                    <input type="text" name="username"  class="form-control" id="txt_name" placeholder="用户名">
                </div>
                <div class="form-group">
                	<label for="txt_pwd">密码</label>
                    <input type="password" name="password"  class="form-control" id="txt_pwd" placeholder="密码">
                </div>
                <!-- 以上为要修改的内容 -->
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>登录</button>
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" th:inline="javascript">
    $(function () {
 		var options= {
			message: '验证不通过',
			feedbackIcons: {
              valid: 'glyphicon glyphicon-ok',
              invalid: 'glyphicon glyphicon-remove',
              validating: 'glyphicon glyphicon-refresh'
          	},
          	fields:  {
				username: {
					validators: {
						notEmpty: {
							message: '用户名不能为空'
						}
					}
				},
				password: {
					validators: {
						notEmpty: {
							message: '密码不能为空'
						}
					}
				}
		}
 	};
 		 $('#loginForm').bootstrapValidator(options);
       /*  $('#loginForm').bootstrapValidator(options).on('success.form.bv', function(e) {
        	e.preventDefault();	//很重要没有它则会提交默认表单，不会做下面的ajax表单提交
            var fd = new FormData($("#loginForm")[0]);
            var url=[[${#httpServletRequest.contextPath}]]+'/login';
            
            $.ajax({  
              url: url,  
              type: "POST",  
              data: fd,
              dataType:'json',
              processData: false,  // 不处理数据  
              contentType: false,   // 不设置内容类型
              success:function(data){
            	  $('#myModal').modal("hide");
            	  //var json=eval('('+data+')');
            	  if(data.success){
	            	  window.location.reload();
            	  }else{
            		  bootbox.alert(data.msg);
            	  }
              }
            });  
        }); */
        

    });
</script>